<template>
  <div class="child2">
      <h1>child2</h1>
      <h3>{{msgFromChild2}}</h3>
  </div>
</template>

<script>
import event from '../utils/event';
export default {
  data(){
    return {
      // 接收child2发送的数
      msgFromChild2:''
    }
  },
  created(){
    event.$on('message',(data)=>{
      // console.log(data);
      this.msgFromChild2=data;
    });
  }
}
</script>

<style>
.child2{
    background-color: lightblue;
    padding: 10px;
    margin: 10px;
}
</style>